<%@page import="weixinkeji.dev.dc.base.scheme.promotions.cache.PromotionConfigControl"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jspf/must/basePath.jspf" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>服务员下单</title>
        <script src="zj/jq/jquery-1.11.3.min.js"></script>
        <%@include file="/WEB-INF/jspf/zj/uikit/uikit.jspf" %>
        <%@include file="/WEB-INF/jspf/zj/uikit/sticky.jspf" %>
        <script type = "text/javascript">
            $(function () {
                $.post("view/show/promotionday/today.imy", {}, function (data) {
                    if (null != data) {
                        var str = "";
                        for (var i = 0; i < data.length; i++) {
                            str = str + tableTR_Date(
                                    data[i].food_img
                                    , data[i].food_name + "(" + data[i].unit_name + ")"
                                    , data[i].food_price
                                    , data[i].promotion_price
                                    , data[i].promotion_now_number
                                    , data[i].promotion_id
                                    );
                        }
                        $("#indexSY").html(str);
                    }
                }, "json");
                function tableTR_Date(img, name, money, pmoney, pmun, pID) {
                    var str = "<tr>"
                            + "<td><a href=\"#showMyPromotionDayImg\" data-uk-modal onclick=\"showImg('" + img + "')\"><img src=\"" + img + "\" width=\"40px\" height=\"40px\"></a></td>"
                            + "<td class=\"uk-text-middle uk-text-center\">" + name + "</td>"
                            + "<td class=\"uk-text-middle uk-text-center\">" + money + "</td>"
                            + "<td class=\"uk-text-middle uk-text-center\" style=\"color:red\">" + pmoney + "</td>"
                            + "<td class=\"uk-text-middle uk-text-center\">" + pmun + "</td>"
                            + "<td class=\"uk-text-middle uk-button-primary uk-text-center\" onclick=\"addHD('" + pID + "')\">下单</td>"
                            + "</tr>";
                    return str;
                }
            });
            function showImg(imgsrc) {
                $("#SHOW_IMG_ID").attr("src", imgsrc);
            }
            function addHD(food_id) {
                $.post("weixinkeji/dev/dc/buy/order/a/add.imy", {
                    sort: 2
                    , id: food_id
                    , number: 1.0
                }, function (d) {//d.statusCode == 200
                    if (d.statusCode == 200) {
                        UIkit.notify(d.message, {timeout: 1200, status: 'success'});
                    } else {
                        UIkit.notify(d.message, {timeout: 2000, status: 'warning'});
                    }
                }, "json");
            }
        </script>

    </head>

    <body onload="detectBrowser()">
        <div class="uk-width-1" style="margin-top: 15px;margin-bottom: 40px;">
            <nav class="uk-navbar" data-uk-sticky>
                <a class="uk-navbar-brand uk-hidden-small" href="http://imyweb.org"
                   title="IMY框架是一款开源免费的高效高速小巧强大的WEB框架!如果您需要为此产品进行二次开发，您将会需要用到这IMY框架！"
                   target="_blank"
                   >IMY框架</a>
                <div class="uk-container uk-container-center">
                    <ul class="uk-navbar-nav">
                        <%                            if (PromotionConfigControl.checkOK()) {
                                out.print("<li class=\"uk-active\"><a href=\"dc_view/buy/fwy/xd_promotionDay.jsp\">活动</a></li>");
                            }
                        %>
                        <!--<li class="uk-active"><a href="dc_view/buy/fwy/xd_promotionDay.jsp">活动</a></li>-->
                        <li><a href="dc_view/buy/fwy/xd_food.jsp">菜单</a></li>
                        <li><a href="dc_view/buy/fwy/xd_combo.jsp">套餐</a></li>
                        <li><a class="uk-button-primary" href="#showFWYCar" data-uk-modal onclick="selectKD_NOWSelect()">购物车</a></li>
                        <li><a href="dc_view/buy/fwy/kd.jsp">开单</a></li>
                    </ul>
                </div>
            </nav>
        </div>

        <div class="uk-container uk-container-center">
            <div class="uk-margin uk-grid">

                <div class="uk-width-1-1">
                    <div>
                        <h1>
                            今日活动
                        </h1>
                    </div>
                    <div>
                        <table class="uk-table uk-table-hover">
                            <thead  style="text-align: center">
                                <tr>
                                    <th width="55px" class="uk-text-center">预览</th>
                                    <th class="uk-text-center">菜名(单位)</th>
                                    <th class="uk-text-center">原价(元)</th>
                                    <th class="uk-text-center">现购买(元)</th>
                                    <th class="uk-text-center">活动剩余</th>
                                    <th class="uk-text-center">下单操作</th>
                                </tr>
                            </thead>
                            <tbody id="indexSY">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <!-- 模态对话框 -->
        <div id="showMyPromotionDayImg" class="uk-modal">
            <div class="uk-modal-dialog  uk-modal-dialog-lightbox">
                <a href="" class="uk-modal-close uk-close uk-close-alt"></a>
                <div class=" uk-overflow-container"></div> <img id="SHOW_IMG_ID" src="" alt="">
            </div>
        </div>
        <%@include file="/WEB-INF/jspf/dc/fwy/fwyCar.jspf" %>
    </body>
</html>
